/*
题目链接 : https://leetcode.cn/problems/count-the-number-of-beautiful-subarrays/
*/

//题解代码 : 
class Solution {
public:
    // 转换成求子数组异或为0的个数
    long long beautifulSubarrays(vector<int>& nums) {
        long long ans = 0;
        unordered_map<int,int> ump;
        ump[0] = 1;
        int xo=0;
        for(auto& x : nums){
            xo ^= x;
            ans += ump[xo];
            ump[xo]++;
        }
        return ans;
    }
};
